using System;
using System.Collections.Generic;
using System.Text;
using FrameworkQ.ObjectSpace.Data.Providers;
using FrameworkQ.ObjectSpace.Data.SqlObjects.Generation;
using System.Data.SqlClient;

namespace FrameworkQ.ObjectSpace.Data.Providers.SqlServer
{
	public class SqlServerProvider : IDatabaseProvider
	{
		#region IDatabaseProvider Members

		public ISqlDataTypeTranslator GetDataTypeTranslator()
		{
			return new SqlServerDataTypeTranslator();
		}

        public FrameworkQ.ObjectSpace.Data.SqlObjects.Generation.ISqlGenerator GetGenerator()
        {
            return new SqlServerGenerator();
        }

        public System.Data.IDbConnection CreateConnection(string connectionString)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            connection.Open();
            return connection;
        }

        public System.Data.IDbCommand CreateCommand(System.Data.IDbConnection conn)
        {
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = (SqlConnection)conn;
            return cmd;
        }

        public System.Data.IDbTransaction CreateTransaction(System.Data.IDbConnection conn)
        {
            throw new NotImplementedException();
        }

        public System.Data.Common.DbParameter CreateParameter()
        {
            return new SqlParameter();
        }

        #endregion
    }
}
